
console.log(1);

(function(undefined){

console.log(4);

FLT.CMP.reg('Menu', 'Widget',{
    
    defaults: {
        ftype: 'MenuItem'
    },
    
    mouseover: function(){
        this.$.show();
    },
    
    draw_from: function(source) {
        
        var $el = (source instanceof FLT.CMP.Cmp) ? source.$ : $(source);
        this.draw().$.css({
            left: $el.right() + 'px',
            top: $el.offset().top + 'px'
        });
    }
},{ //DEEPCOPY
    css: { 
        position:'absolute'
    }
});

FLT.CMP.reg('MenuItem', 'Button',{
    
},{ //DEEPCOPY
    css: {
        'list-style':'none'
    }
});

FLT.CMP.reg('SubMenuItem', 'MenuItem',{
    
    mouseover: function(){
        if (this.menu) {
            
            $('.ftype-SubMenuItem:visible').each(function() {
                var $menu = $(this).cmp().menu.$;
                if ($menu) $menu.hide();
            });
            
            this.menu.drawFrom(this);
        }
    },
    
    mouseout: function(){
        if (this.menu) { this.menu.$.hide(); }
    }
    
});

FLT.CMP.reg('ToolBar', 'Widget',{
    
    defaults: {
        ftype: 'Tool'
    },
    
    html: "<div></div>"
});

FLT.CMP.reg('Tool', 'Button',{
    
    html: "<div></div>",
    
    click: function(){
        if (this.menu) {
            this.menu.draw().$.css({
                left: this.$.offset().left + 'px',
                top: this.$.bottom() + 'px'
            });
        }
    }
    
},{ // DEEPCOPY
    css: {
        display:'inline'
    }
});

})(); // end module


